(in-package :cl-user)
(defpackage crowdsourcing-cl.stereotype
  (:use :cl)
  (:export :stereotype))
(in-package :crowdsourcing-cl.stereotype)

(defparameter *bean-registry* (make-hash-table :test 'equal))

(cl-annot:defannotation stereotype (class-definition-form)
    (:arity 1)
  (cl-annot.util:progn-form-replace-last
     (lambda (class-definition-form)
       (let ((symbol (cl-annot.util:definition-form-symbol class-definition-form)))
	 `(progn
	    ()
	    ,class-definition-form
	    (print (find-class ',symbol))
	    (or (gethash ',symbol *bean-registry*)
		(setf (gethash ',symbol *bean-registry*) (make-instance ',symbol))))
	 ))
     class-definition-form))


(defmacro export-slots (class-definition-form)
  (cl-annot.util:progn-form-replace-last
     (lambda (class-definition-form)
       (let ((symbol (cl-annot.util:definition-form-symbol class-definition-form)))
	 (format t "-----------------stereotype")
	 ;(print (find-class class-definition-form))
	 `(progn
	    ()
	    ,class-definition-form
	    (print (find-class ',symbol))
	    (or (gethash ',symbol *bean-registry*)
		(setf (gethash ',symbol *bean-registry*) (make-instance ',symbol))))
	 ))
     class-definition-form))


  
